package com.explorati.LinkedList;

//递归实现链表的添加功能
public class LinkedList1 {

	private ListNode head;

	public LinkedList1(){
		head = null;
	}
	public ListNode addElement(ListNode head, int val) {
		if (head == null) {
			head = new ListNode(null,val);
			return head;
		}
		ListNode res = addElement(head.next, val);
		head.next = res;
		return head;
	}

}
